package JSE_05.Demo05;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

public class Demo05Stream {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("md_00\\src\\JSE_05\\Demo05\\c.txt");
        // fos.write(97);

//        byte[] bytes={65,66,67,68,69};
//        fos.write(bytes,1,2);
        byte[] byte2="你好".getBytes();
        System.out.println(Arrays.toString(byte2)); // => [-28, -67, -96, -27, -91, -67] utf-8三个字节是一个中文 gbk两个字节是一个中文
        fos.write(byte2);
        fos.write("\r\n".getBytes());
        fos.close();

        FileOutputStream fos_00=new FileOutputStream("D:\\code\\JCode\\J_test00\\md_00\\src\\JSE_05\\Demo05\\b.txt",true);
        for(int i=0;i<10;i++){
            fos_00.write("Hello World".getBytes());
            fos_00.write("\r\n".getBytes());
        }

        fos_00.close();
    }
}
